package org.example.serviceEdu.controller;


import org.example.ResultCode.R;
import org.example.serviceEdu.entity.subject.OneSubject;
import org.example.serviceEdu.service.EduSubjectService;
import org.example.serviceEdu.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author lining
 * @since 2023-10-23
 */
@CrossOrigin
@RestController
@RequestMapping("/serviceEdu/subject")
public class EduSubjectController {


    @Autowired
    private EduSubjectService subjectService;
    //    获取excel表的内容
    @PostMapping("addSubject")
    public R addSubject(MultipartFile file ){
        subjectService.saveSubject(file,subjectService);
        return R.ok();
    }
    //课程分类列表（树形）
    @GetMapping("getAllSubject")
    public R getAllSubject(){
        List<OneSubject> list=subjectService.getAllOneTwoSubject();
        return R.ok().data("list",list);



    }


}

